function schedulability=RM_schedulability_test(task_Properties)

%Initialize

%the number of all tasks according to the matrix size
[task_Num,~]=size(task_Properties);

schedulability=0;

%Extract Ci, Ci_0, Ti, Di, Li
task_Exe_Time=task_Properties(:,1)';
task_Exe_Time_Overload=task_Properties(:,2)';
task_Period=task_Properties(:,3)';
task_Due_Time=task_Properties(:,4)';
task_Criticality=task_Properties(:,5)';

%initializing the vector to accelerate the code
task_Response_Time=zeros(1,task_Num);

%just consider RMA
task_Priority=1./task_Period;

for i=1:task_Num
    
    R=task_Exe_Time_Overload(i);
    R_last=0;
    %get the response time of task i
    while(R~=R_last)&&(R<=task_Due_Time(i))
        R_last=R;
        
        %those with a smaller period will have a higher priority
        %they will preempt task i and Ri will be larger
        %then more jobs of higher priority tasks can be inside
        sum_temp=0;        
        for j=1:task_Num
            %don't forget the task itself, so use ">="
            if task_Priority(j)>=task_Priority(i)
                if task_Criticality(j)>task_Criticality(i)
                    sum_temp=sum_temp+ceil(R/task_Period(j))*task_Exe_Time(j);
                else
                    %tasks with smaller criticality and the task its self
                    sum_temp=sum_temp+ceil(R/task_Period(j))*task_Exe_Time_Overload(j);  
                end
            end
        end
        R=sum_temp;
    end
    
   task_Response_Time(i)=R;
end

if(sum((task_Due_Time-task_Response_Time)<0)==0)
    schedulability=1;
end




